home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / m2cmp20 / filespec.def < prev    next >
Text File  |  1988-11-19  |  2KB  |  96 lines

  1. DEFINITION MODULE FileSpec;
  2.  
  3. (* (C) Copyright 1987,1988 Fitted Software Tools. All rights reserved. *)
  4.  
  5. (*
  6.     The procedures in this module help the user manipulate path names.
  7.  
  8.     These procedures do not actually check the validity of a path
  9.     name: they just break the components up, based on the DOS syntax
  10.     for a path name.
  11.  
  12.     Example: ParseFileSpec will return for '\m2\comp' a dir of 'm2' and
  13.     a filename of 'comp' even if '\m2\comp' is the name of an existing
  14.     directory.
  15. *)
  16.  
  17. PROCEDURE ParseFileSpec(
  18.             filespec    :ARRAY OF CHAR;
  19.             VAR drive   :CHAR;
  20.             VAR dir     :ARRAY OF CHAR;
  21.             VAR name    :ARRAY OF CHAR;
  22.             VAR ext     :ARRAY OF CHAR
  23.             );
  24.  
  25.     (*  Description of output:
  26.  
  27.         Only those portions present in filespec will be returned;
  28.         the other fields will be loaded with a null in the first
  29.         position.
  30.  
  31.         drive:  the specified drive
  32.         dir:    the specified directory path
  33.         name:   the file name specified, stripped of the extension
  34.         ext:    the file name extension
  35.     *)
  36.  
  37.  
  38.     (*  Example:
  39.  
  40.             ParseFileName( "d:m2\comp\mc.mod", drive, dir, name, ext );
  41.  
  42.         would return:
  43.  
  44.             drive   = "d"
  45.             dir     = "m2\comp"
  46.             name    = "mc"
  47.             ext     = "mod"
  48.     *)
  49.  
  50. PROCEDURE ExtractDirPath( filespec :ARRAY OF CHAR; VAR dir :ARRAY OF CHAR );
  51.     (*
  52.         returns the filespec without the file name portion in dir
  53.     *)
  54.     (*  Example:
  55.  
  56.             ExtractDirName( "d:m2\comp\mc.mod", dir );
  57.  
  58.         would return:
  59.  
  60.             dir = "d:m2\comp"
  61.     *)
  62.  
  63. PROCEDURE ExtractFileName( filespec :ARRAY OF CHAR; VAR name :ARRAY OF CHAR );
  64.     (*
  65.         returns in name, the file name portion of filespec
  66.     *)
  67.     (*  Example:
  68.  
  69.             ExtractFileName( "d:m2\comp\mc.mod", name );
  70.  
  71.         would return:
  72.  
  73.             name = "mc.mod"
  74.     *)
  75.  
  76.  
  77. PROCEDURE DropExt( filespec :ARRAY OF CHAR; VAR newspec :ARRAY OF CHAR );
  78.     (*
  79.         returns filespec less the file name extension in newspec
  80.     *)
  81.     (*  Example:
  82.  
  83.             ExtractFileName( "d:m2\comp\mc.mod", newspec );
  84.  
  85.         would return:
  86.  
  87.             newspec = "d:m2\comp\mc"
  88.     *)
  89.  
  90. PROCEDURE HasExt( filespec :ARRAY OF CHAR ) :BOOLEAN;
  91.     (*
  92.         TRUE if filespec includes extension
  93.     *)
  94.  
  95.  
  96. END FileSpec.